home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Documentation / Tech Notes & Articles / Recipes / Imaging & Layout / Determining Print Resolution < prev    next >
Encoding:
Text File  |  1995-11-07  |  3.4 KB  |  32 lines  |  [TEXT/ttxt]

  1. OpenDoc™ Recipes
  2.  
  3. Determining Print Resolution
  4. by OpenDoc Design Team
  5. November 7th, 1995
  6.  
  7.  
  8. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  9. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  10. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  11.  
  12.  
  13. Setting the correct print resolution
  14.  
  15. When a root part of a window receives a print command, it must set up a print job and cause all the pages to be imaged. A subtlety of creating the print job is determining the right resolution. Some graphics systems — such as QuickDraw on the Macintosh — are resolution-dependent, and their associated print managers need advance knowlege of the resolution of the print job if it's not to be the default 72dpi.  If the root part or an embedded part needs extra resolution, say if it's a 300dpi graphic, the root part must create a print job that can handle that resolution. Since the root part can't know or guess what resolution is right for all the embedded parts, it must ask them.
  16.  
  17. The root part must iterate over each embedded frame that will be printed. It uses the ODPart::GetPrintResolution() call to ask the part of each frame what print resolution it requires, and sets up the job with the maximum value of the set of answers. Of course, the root part must also consider the resolution required by its own frames.
  18.  
  19. Whether a print job needs to know its resolution, and how to set its resolution, are both graphics system dependent. In this recipe we'll just consider the two Mac™ OS graphics systems.
  20.  
  21. QuickDraw GX is resolution independent and uses fractional (fixed-point) coordinates, so its print jobs do not require any knowlege of resolution. End of story.
  22.  
  23. QuickDraw is resolution dependent. To increase the resolution of a print job, call PrGeneral. You'll first need to query the available resolutions using the GetRslData opcode, then select the appropriate resolution using SetResolution. The process is detailed in Macintosh Tech Note PR07, PrGeneral.
  24.  
  25. The effect of this will be to shrink the “pixels” in the printing GrafPort — the size of the portRect will increase proportionally, and anything drawn will come out proportionally smaller. Therefore, all coordinates need to be scaled up manually before making QuickDraw calls. The best way to indicate this is to set the external transform of the root facet to be printed, by applying a scaling factor that's the proportion by which the resolution is being increased. For example, when printing at 300dpi the scaling factor would be 300÷72 = 4.1667 in each direction.
  26.  
  27. Unfortunately, this assumes that all the parts being printed will recognize the scaling factor in their content transforms. Since these are all QuickDraw-based parts (they can't be using GX, or the print job would also be GX-based and we wouldn't have to go through this) the only way they can handle scaling factors is to note the scaling and manually scale all coordinates passed to QuickDraw. The part requesting higher resolution will know that this is going to happen and will presumably have been written to handle it. Other parts, however, may not. If they are printed at high resolution they may image themselves incorrectly. For this reason, it's probably best to make high-resolution printing a user-settable option for the root part, so it can be disabled by the user if it causes incompatibilities with other embedded parts.
  28.  
  29. See Also
  30.  
  31. Mac Tech Note PR07, PrGeneral.
  32. “Meet PrGeneral”, in issue 3 of develop. (Includes sample code.)